<% layout('/layouts/default.html', {title: '品牌管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text(brand.isNewRecord ? '新增品牌' : '编辑品牌')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${brand}" action="${ctx}/storage/brand/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('基本信息')}</div>
			<#form:hidden path="id"/>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('顺序')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="sort" maxlength="255" class="form-control required digits"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('名称')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="name" maxlength="255" class="form-control required"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('联系人')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="contact" maxlength="255" class="form-control"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('联系号码')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="phone" maxlength="255" class="form-control"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required ">*</span> ${text('仓库')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<#form:select path="store" class="form-control" readonly="${!brand.isNewRecord}" items="${provinces}" itemLabel="areaName" itemValue="areaName"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required ">*</span> ${text('LOGO')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<div style="color:red;margin-bottom:10px;">
								建议尺寸：184PX * 184PX
							</div>
							<#form:hidden id="logo" name="logo" path="logo" class="form-control"/>
							<#form:fileupload id="imageLogo" uploadType="image" returnPath="true" filePathInputId="logo" class="form-control" readonly="false" maxUploadNum="1" imageMaxWidth="184" imageMaxHeight="184"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required ">*</span> ${text('透明LOGO')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<div style="color:red;margin-bottom:10px;">
								建议尺寸：184PX * 184PX
							</div>
							<#form:hidden id="transparentLogo" name="transparentLogo" path="transparentLogo" class="form-control"/>
							<#form:fileupload id="imageTransparentLogo" uploadType="image" returnPath="true" filePathInputId="transparentLogo" class="form-control" readonly="false" maxUploadNum="1" imageMaxWidth="184" imageMaxHeight="184"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required ">*</span> ${text('背景图')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<div style="color:red;margin-bottom:10px;">
								建议尺寸：1125PX * 720PX
							</div>
							<#form:hidden id="background" name="background" path="background" class="form-control"/>
							<#form:fileupload id="imagebackground" uploadType="image" returnPath="true" filePathInputId="background" class="form-control" readonly="false" maxUploadNum="1" imageMaxWidth="1125" imageMaxHeight="720"/>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="box-footer">
		<div class="row">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
				<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
			</div>
		</div>
	</div>
</#form:form>
</div>
</div>
<% } %>
<script>
	$("#inputForm").validate({
		submitHandler: function(form){
			js.ajaxSubmitForm($(form), function(data){
				js.showMessage(data.message);
				if(data.result == Global.TRUE){
					js.closeCurrentTabPage(function(contentWindow){
						contentWindow.page();
					});
				}
			}, "json");
		}
	});
</script>
